home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / u_man / cat3 / Tcl / enterfile.z / enterfile
Encoding:
Text File  |  1998-10-30  |  6.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee((((3333TTTTccccllll))))                                        TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee((((3333TTTTccccllll))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      Tcl_EnterFile, Tcl_GetOpenFile, Tcl_FilePermissions - manipulate the
  10.      table of open files
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
  14.  
  15.      TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee(_i_n_t_e_r_p, _f_i_l_e, _p_e_r_m_i_s_s_i_o_n_s)
  16.  
  17.      int
  18.      TTTTccccllll____GGGGeeeettttOOOOppppeeeennnnFFFFiiiilllleeee(_i_n_t_e_r_p, _s_t_r_i_n_g, _w_r_i_t_e, _c_h_e_c_k_U_s_a_g_e, _f_i_l_e_P_t_r)
  19.  
  20.      int
  21.      TTTTccccllll____FFFFiiiilllleeeePPPPeeeerrrrmmmmiiiissssssssiiiioooonnnnssss((((_f_i_l_e)
  22.  
  23. AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
  24.      Tcl_Interp   *_i_n_t_e_r_p      (in)      Tcl interpreter from which file is to
  25.                                          be accessed.
  26.  
  27.      FILE         *_f_i_l_e        (in)      Handle for file that is to become
  28.                                          accessible in _i_n_t_e_r_p.
  29.  
  30.      int          _p_e_r_m_i_s_s_i_o_n_s  (in)      OR-ed combination of
  31.                                          TCL_FILE_READABLE and
  32.                                          TCL_FILE_WRITABLE; indicates whether
  33.                                          _f_i_l_e was opened for reading or
  34.                                          writing or both.
  35.  
  36.      char         *_s_t_r_i_n_g      (in)      String identifying file, such as
  37.                                          ssssttttddddiiiinnnn or ffffiiiilllleeee4444.
  38.  
  39.      int          _w_r_i_t_e        (in)      Non-zero means the file will be used
  40.                                          for writing, zero means it will be
  41.                                          used for reading.
  42.  
  43.      int          _c_h_e_c_k_U_s_a_g_e   (in)      If non-zero, then an error will be
  44.                                          generated if the file wasn't opened
  45.                                          for the access indicated by _w_r_i_t_e.
  46.  
  47.      FILE         **_f_i_l_e_P_t_r    (out)     Points to word in which to store
  48.                                          pointer to FILE structure for the
  49.                                          file given by _s_t_r_i_n_g.
  50.  
  51.  
  52. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  53.      These procedures provide access to Tcl's file naming mechanism.
  54.      TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee enters an open file into Tcl's file table so that it can be
  55.      accessed using Tcl commands like ggggeeeettttssss, ppppuuuuttttssss, sssseeeeeeeekkkk, and cccclllloooosssseeee.  It returns
  56.      in _i_n_t_e_r_p->_r_e_s_u_l_t an identifier such as ffffiiiilllleeee4444 that can be used to refer
  57.      to the file in subsequent Tcl commands.  TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee is typically used
  58.      to implement new Tcl commands that open sockets, pipes, or other kinds of
  59.      files not already supported by the built-in commands.
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee((((3333TTTTccccllll))))                                        TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee((((3333TTTTccccllll))))
  71.  
  72.  
  73.  
  74.      TTTTccccllll____GGGGeeeettttOOOOppppeeeennnnFFFFiiiilllleeee takes as argument a file identifier of the form returned
  75.      by the ooooppppeeeennnn command or TTTTccccllll____EEEEnnnntttteeeerrrrFFFFiiiilllleeee and returns at *_f_i_l_e_P_t_r a pointer to
  76.      the FILE structure for the file.  The _w_r_i_t_e argument indicates whether
  77.      the FILE pointer will be used for reading or writing.  In some cases,
  78.      such as a file that connects to a pipeline of subprocesses, different
  79.      FILE pointers will be returned for reading and writing.  TTTTccccllll____GGGGeeeettttOOOOppppeeeennnnFFFFiiiilllleeee
  80.      normally returns TCL_OK.  If an error occurs in TTTTccccllll____GGGGeeeettttOOOOppppeeeennnnFFFFiiiilllleeee (e.g.
  81.      _s_t_r_i_n_g didn't make any sense or _c_h_e_c_k_U_s_a_g_e was set and the file wasn't
  82.      opened for the access specified by _w_r_i_t_e) then TCL_ERROR is returned and
  83.      _i_n_t_e_r_p->_r_e_s_u_l_t will contain an error message.  If _c_h_e_c_k_U_s_a_g_e is zero and
  84.      the file wasn't opened for the access specified by _w_r_i_t_e, then the FILE
  85.      pointer returned at *_f_i_l_e_P_t_r may not correspond to _w_r_i_t_e.
  86.  
  87.      TTTTccccllll____FFFFiiiilllleeeePPPPeeeerrrrmmmmiiiissssssssiiiioooonnnnssss returns an OR-ed combination of the mask bits
  88.      TCL_FILE_READABLE and TCL_FILE_WRITABLE; these indicate whether the given
  89.      file was opened for reading or writing or both.  If _f_i_l_e does not refer
  90.      to a file in Tcl's file table then -1 is returned.
  91.  
  92.  
  93. KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  94.      file table, permissions, pipeline, read, write
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.